﻿#ifndef _BRICK_H_
#define _BRICK_H_
#include <d3dx9.h>
#include "Sprite.h"
#include "CGame.h"
#include "Object.h"
#include "Global.h"
#include "Texture.h"


#define GRAVITY		0.01

class Brick : public Object
{

public:
	Texture * _texture;
	float _xPre;
	float _yPre;
	
	bool isLastMoveUp;			//kiem tra gach co duoc day len chua?

	Sprite* _spriteArr[4];
	bool isBreaked;

	float	xBreak1;		//Tham số của các mảnh vỡ. 1 là mảnh trên, 2 là mảnh dưới
	float	yBreak1;
	float	xBreak2;
	float	yBreak2;
	float	vyBreak1;
	float	vyBreak2;
	float	vxBreak1;
	float	vxBreak2;
	float	ayBreak;
	float	angle;


	float _timeBreak;
	//list<BreakBrick*> _breakPart;


	Brick(int id, float x, float y, int state, int type);
	~Brick(void);
	void Render(int vpX, int vpY);
	void Update(list<Object *> *_list, float time);
	void ChangeState(int state);
	OBJECT_TYPE getObjectType();
};

#endif